package com.ali.config;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;

/**
 * 自定义授权规则
 */
@Component
public class MyRequestOriginParser implements RequestOriginParser {
    private static final String KEY = "username";

    @Override
    public String parseOrigin(HttpServletRequest httpServletRequest) {
        return httpServletRequest.getHeader(KEY);
    }
}
